<template>
  <div class="body">
    <div class="nav">
      <ul>
        <li @click="fanh">
          <div class="img">
            <img src="../assets/syb.png" alt="" />
          </div>
        </li>
        <li><span>已评论</span></li>
      </ul>
    </div>
    <ul class="zhujia">
      <li>评价完成</li>
      <li>追加评价</li>
    </ul>
    <div class="conts">
      <orderformdata :yeshu="png"></orderformdata>
    </div>
  </div>
</template>

<script>
import API from "../http/API";
import orderformdata from "../components/orderform/zhujian.vue";
export default {
  name: "ypingl",
  components: {
    orderformdata,
  },
  data() {
    return {
      png: 1,
    };
  },
  created() {},

  activated() {
    this.guanb();
  },
  methods: {
    fanh() {
      this.$router.go(-1);
    },
    lazyLoading() {
      this.$route.meta.Yaxis = window.pageYOffset;

      let scrollTop =
        document.documentElement.scrollTop || document.body.scrollTop;
      let clientHeight = document.documentElement.clientHeight;
      let scrollHeight = document.documentElement.scrollHeight;
      if (scrollTop + clientHeight >= scrollHeight) {
        console.log("滚动到底部，触发");

        this.mai();
      }
    },
    mai() {
      setTimeout(() => {
        console.log("发起网络请求");
        this.png++;
        // console.log(this.complete);
      }, 500);
    },
    guanb() {
      window.addEventListener("scroll", this.lazyLoading);
    },
  },
  deactivated() {
    window.removeEventListener("scroll", this.lazyLoading);
  },
  beforeRouteLeave(to, from, next) {
    console.log(to);
    if (to.name != "orderdetails") {
      this.$route.meta.Yaxis = 0;
    }
    next();
  },
};
</script>

<style lang="less" scoped>
.body {
  height: 100%;
  background-color: rgb(230, 230, 230);
  .nav {
    width: 100%;
    height: 50px;
    background-color: rgb(255, 255, 255);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 55;
    ul {
      margin-left: 10px;
      margin-right: 10px;
      // border: 1px solid #000;
      height: 100%;
      display: flex;
      align-items: center;
      li {
        &:nth-child(1) {
          width: 50px;
          height: 50px;
          // border: 1px solid #000;
          display: flex;
          align-items: center;
          .img {
            height: 20px;
            width: 20px;
            img {
              width: 100%;
              height: 100%;
            }
          }
        }
        &:nth-child(2) {
          font-size: 17px;
        }
      }
    }
  }
  .zhujia {
    position: fixed;
    top: 60px;
    left: 0;
    display: flex;
    margin-left: 10px;
    li {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 80px;
      margin-left: 10px;
      height: 20px;
      text-align: center;
      line-height: 20px;
      border-radius: 5px;
      background-color: rgb(255, 255, 255);
    }
  }
  .conts {
    background-color: white;
  }
}
</style>